package GUI;

import GUI.Dialogos.AccesoNoPermitido;
import GUI.Dialogos.Creditos;
import GUI.Dialogos.DialogoConexion;
import GUI.Dialogos.DialogoInformeUsuario;
import GUI.Dialogos.DialogoSalida;
import GUI.Dialogos.EdicionBD;
import Logica.EManager;
import Logica.EjecucionParametros;
import Objetos.Cliente;
import Objetos.Provincia;
import java.awt.Image;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.table.DefaultTableModel;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author jose
 */
public class Principal extends javax.swing.JFrame {
    private EManager gestor=new EManager();
    private DefaultTableModel tablaCliente;
    private Cliente clienteSeleccionado;
    /**
     * Creates new form Principal
     */
    public Principal() {
        //Inicializaremos el TableModel donde se mostrarán los clientes: debe realizarse antes del
        //initComponents()
        tablaCliente = new DefaultTableModel();
        tablaCliente.addColumn("Nombre");
        tablaCliente.addColumn("Apellido1");
        tablaCliente.addColumn("Apellido2");
        tablaCliente.addColumn("Provincia");
        tablaCliente.addColumn("Localidad");
        tablaCliente.addColumn("Calle");
        tablaCliente.addColumn("Nº");
        tablaCliente.addColumn("Piso");
        tablaCliente.addColumn("Metros");
        tablaCliente.addTableModelListener(tablaClientesAsociada);
        //Inicialización de componentes
        initComponents();
        initImagenes();
        initPaneles();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jSeparator1 = new javax.swing.JSeparator();
        botonClientes = new javax.swing.JButton();
        botonInformes = new javax.swing.JButton();
        lblimagenInformes = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        lblCopyLeft = new javax.swing.JLabel();
        lblClientes = new javax.swing.JLabel();
        PanelContenido = new javax.swing.JPanel();
        panelContenidoInicial = new javax.swing.JPanel();
        panelContenidoClientes = new javax.swing.JPanel();
        panelContCliBusqueda = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtApellido2 = new javax.swing.JTextField();
        txtApellido1 = new javax.swing.JTextField();
        txtNombre = new javax.swing.JTextField();
        comboProvincia = new javax.swing.JComboBox();
        comboLocalidades = new javax.swing.JComboBox();
        comboCalles = new javax.swing.JComboBox();
        botonBuscar = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        txtNumero = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txtPiso = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        txtMetro = new javax.swing.JTextField();
        botonVerInforme = new javax.swing.JButton();
        panelContCliOpciones = new javax.swing.JPanel();
        botonNuevoCliente = new javax.swing.JButton();
        botonModificarCliente = new javax.swing.JButton();
        botonBorrar = new javax.swing.JButton();
        panelContCliLista = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tablaClientesAsociada = new javax.swing.JTable();
        panelContenidoInformes = new javax.swing.JPanel();
        panelContInformesSeleccion = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        comboTipoInforme = new javax.swing.JComboBox();
        PanelSelector = new javax.swing.JPanel();
        SelectorMensual = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        comboSelecMes = new javax.swing.JComboBox();
        SelectorAnual = new javax.swing.JPanel();
        comboSelecAnho = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        panelContInformesContenido = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        botonCrearInforme = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        panelInforme = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        lblLugar = new javax.swing.JLabel();
        lblFecha = new javax.swing.JLabel();
        lblValor = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        lblConsumoMedio = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jPanel12 = new javax.swing.JPanel();
        panelContInformesSeleccion1 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        comboSelecTerritorio = new javax.swing.JComboBox();
        PanelSelector1 = new javax.swing.JPanel();
        SelectorMensual1 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        comboSelecLocalidad = new javax.swing.JComboBox();
        SelectorAnual1 = new javax.swing.JPanel();
        comboSelecProvincia = new javax.swing.JComboBox();
        jLabel12 = new javax.swing.JLabel();
        lblEstadoBD = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu3 = new javax.swing.JMenu();
        menuItemConectar = new javax.swing.JMenuItem();
        menuItemSalir = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        Informes = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(254, 254, 254));
        jPanel1.setLayout(new java.awt.BorderLayout());

        jPanel2.setBackground(new java.awt.Color(254, 254, 254));
        jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);

        botonClientes.setText("Administrar\n clientes");
        botonClientes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonClientesActionPerformed(evt);
            }
        });

        botonInformes.setText("Crear informes");
        botonInformes.setToolTipText("");
        botonInformes.setActionCommand("Crear informe");
        botonInformes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonInformesActionPerformed(evt);
            }
        });

        lblCopyLeft.setText(" E-Manager 2012");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(botonClientes)
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblCopyLeft)
                                    .addComponent(jSeparator2))
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(28, 28, 28)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(botonInformes)
                                    .addComponent(lblimagenInformes)))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(lblClientes)))
                        .addContainerGap())))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(43, 43, 43)
                .addComponent(lblClientes)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(botonClientes)
                .addGap(99, 99, 99)
                .addComponent(lblimagenInformes)
                .addGap(15, 15, 15)
                .addComponent(botonInformes)
                .addGap(18, 18, 18)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblCopyLeft)
                .addContainerGap(250, Short.MAX_VALUE))
            .addComponent(jSeparator1)
        );

        jPanel1.add(jPanel2, java.awt.BorderLayout.LINE_END);

        PanelContenido.setToolTipText("");
        PanelContenido.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        PanelContenido.setOpaque(false);
        PanelContenido.setLayout(new java.awt.CardLayout());

        panelContenidoInicial.setBackground(new java.awt.Color(254, 254, 254));
        panelContenidoInicial.setOpaque(false);

        javax.swing.GroupLayout panelContenidoInicialLayout = new javax.swing.GroupLayout(panelContenidoInicial);
        panelContenidoInicial.setLayout(panelContenidoInicialLayout);
        panelContenidoInicialLayout.setHorizontalGroup(
            panelContenidoInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 662, Short.MAX_VALUE)
        );
        panelContenidoInicialLayout.setVerticalGroup(
            panelContenidoInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 536, Short.MAX_VALUE)
        );

        PanelContenido.add(panelContenidoInicial, "card2");

        panelContenidoClientes.setBackground(new java.awt.Color(254, 254, 254));
        panelContenidoClientes.setLayout(new java.awt.BorderLayout());

        panelContCliBusqueda.setBackground(new java.awt.Color(254, 254, 254));

        jLabel1.setText("Nombre:");

        jLabel2.setText("Apellido 1:");

        jLabel3.setText("Apellido 2:");

        txtApellido2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtApellido2ActionPerformed(evt);
            }
        });

        txtApellido1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtApellido1ActionPerformed(evt);
            }
        });

        comboProvincia.setModel(new javax.swing.DefaultComboBoxModel());
        comboProvincia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboProvinciaActionPerformed(evt);
            }
        });

        comboLocalidades.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<-- Localidad -->" }));
        comboLocalidades.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboLocalidadesActionPerformed(evt);
            }
        });

        comboCalles.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<-- Calle -->" }));
        comboCalles.setPreferredSize(new java.awt.Dimension(235, 31));
        comboCalles.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboCallesActionPerformed(evt);
            }
        });

        botonBuscar.setText("Buscar");
        botonBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonBuscarActionPerformed(evt);
            }
        });

        jLabel4.setText("Nº");

        jLabel5.setText("P:");

        jLabel6.setText("m:");

        botonVerInforme.setText("Ver informe");
        botonVerInforme.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonVerInformeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelContCliBusquedaLayout = new javax.swing.GroupLayout(panelContCliBusqueda);
        panelContCliBusqueda.setLayout(panelContCliBusquedaLayout);
        panelContCliBusquedaLayout.setHorizontalGroup(
            panelContCliBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelContCliBusquedaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelContCliBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(panelContCliBusquedaLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNombre))
                    .addComponent(comboProvincia, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelContCliBusquedaLayout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(3, 3, 3)
                        .addComponent(jLabel5)
                        .addGap(6, 6, 6)
                        .addComponent(txtPiso, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtMetro, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(31, 31, 31)
                .addGroup(panelContCliBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(panelContCliBusquedaLayout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtApellido1))
                    .addComponent(comboLocalidades, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(panelContCliBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(panelContCliBusquedaLayout.createSequentialGroup()
                        .addComponent(botonBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(39, 39, 39)
                        .addComponent(botonVerInforme))
                    .addGroup(panelContCliBusquedaLayout.createSequentialGroup()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtApellido2, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(comboCalles, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        panelContCliBusquedaLayout.setVerticalGroup(
            panelContCliBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelContCliBusquedaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelContCliBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(txtApellido2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtApellido1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3)
                .addGroup(panelContCliBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboCalles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboLocalidades, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelContCliBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelContCliBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(botonBuscar)
                        .addComponent(botonVerInforme))
                    .addGroup(panelContCliBusquedaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel4)
                        .addComponent(txtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel5)
                        .addComponent(txtPiso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel6)
                        .addComponent(txtMetro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelContenidoClientes.add(panelContCliBusqueda, java.awt.BorderLayout.PAGE_START);

        panelContCliOpciones.setBackground(new java.awt.Color(254, 254, 254));
        panelContCliOpciones.setLayout(new java.awt.GridLayout(1, 0));

        botonNuevoCliente.setText("Nuevo cliente");
        botonNuevoCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonNuevoClienteActionPerformed(evt);
            }
        });
        panelContCliOpciones.add(botonNuevoCliente);

        botonModificarCliente.setText("Modificar cliente");
        botonModificarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonModificarClienteActionPerformed(evt);
            }
        });
        panelContCliOpciones.add(botonModificarCliente);

        botonBorrar.setText("Dar de baja cliente");
        botonBorrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonBorrarActionPerformed(evt);
            }
        });
        panelContCliOpciones.add(botonBorrar);

        panelContenidoClientes.add(panelContCliOpciones, java.awt.BorderLayout.PAGE_END);

        panelContCliLista.setBackground(new java.awt.Color(254, 254, 254));

        jScrollPane1.setBackground(new java.awt.Color(254, 254, 254));

        tablaClientesAsociada.setModel(tablaCliente);
        tablaClientesAsociada.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tablaClientesAsociadaMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tablaClientesAsociada);

        javax.swing.GroupLayout panelContCliListaLayout = new javax.swing.GroupLayout(panelContCliLista);
        panelContCliLista.setLayout(panelContCliListaLayout);
        panelContCliListaLayout.setHorizontalGroup(
            panelContCliListaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 689, Short.MAX_VALUE)
            .addGroup(panelContCliListaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panelContCliListaLayout.createSequentialGroup()
                    .addGap(18, 18, 18)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 659, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        panelContCliListaLayout.setVerticalGroup(
            panelContCliListaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 375, Short.MAX_VALUE)
            .addGroup(panelContCliListaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panelContCliListaLayout.createSequentialGroup()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 363, Short.MAX_VALUE)
                    .addContainerGap()))
        );

        panelContenidoClientes.add(panelContCliLista, java.awt.BorderLayout.CENTER);

        PanelContenido.add(panelContenidoClientes, "card3");
        panelContenidoClientes.setVisible(false);

        panelContenidoInformes.setBackground(new java.awt.Color(254, 254, 254));
        panelContenidoInformes.setLayout(new java.awt.BorderLayout());

        panelContInformesSeleccion.setBackground(new java.awt.Color(254, 254, 254));
        panelContInformesSeleccion.setLayout(new java.awt.GridLayout(1, 0));

        jPanel3.setBackground(new java.awt.Color(254, 254, 254));

        jLabel7.setText("Tipo de informe:");

        comboTipoInforme.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Mensual", "Anual" }));
        comboTipoInforme.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboTipoInformeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap(61, Short.MAX_VALUE)
                .addComponent(jLabel7)
                .addGap(18, 18, 18)
                .addComponent(comboTipoInforme, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(comboTipoInforme, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelContInformesSeleccion.add(jPanel3);

        PanelSelector.setBackground(new java.awt.Color(254, 254, 254));
        PanelSelector.setLayout(new java.awt.CardLayout());

        SelectorMensual.setBackground(new java.awt.Color(254, 254, 254));

        jLabel9.setText("Mes:");

        comboSelecMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"}));

        javax.swing.GroupLayout SelectorMensualLayout = new javax.swing.GroupLayout(SelectorMensual);
        SelectorMensual.setLayout(SelectorMensualLayout);
        SelectorMensualLayout.setHorizontalGroup(
            SelectorMensualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SelectorMensualLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel9)
                .addGap(18, 18, 18)
                .addComponent(comboSelecMes, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(93, Short.MAX_VALUE))
        );
        SelectorMensualLayout.setVerticalGroup(
            SelectorMensualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SelectorMensualLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(SelectorMensualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboSelecMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addContainerGap())
        );

        PanelSelector.add(SelectorMensual, "card2");

        SelectorAnual.setBackground(new java.awt.Color(254, 254, 254));

        comboSelecAnho.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"2012"}));
        comboSelecAnho.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboSelecAnhoActionPerformed(evt);
            }
        });

        jLabel10.setText("Año:");

        javax.swing.GroupLayout SelectorAnualLayout = new javax.swing.GroupLayout(SelectorAnual);
        SelectorAnual.setLayout(SelectorAnualLayout);
        SelectorAnualLayout.setHorizontalGroup(
            SelectorAnualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SelectorAnualLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel10)
                .addGap(18, 18, 18)
                .addComponent(comboSelecAnho, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(91, Short.MAX_VALUE))
        );
        SelectorAnualLayout.setVerticalGroup(
            SelectorAnualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SelectorAnualLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(SelectorAnualLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboSelecAnho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addContainerGap())
        );

        PanelSelector.add(SelectorAnual, "card2");

        panelContInformesSeleccion.add(PanelSelector);

        panelContenidoInformes.add(panelContInformesSeleccion, java.awt.BorderLayout.PAGE_START);

        panelContInformesContenido.setBackground(new java.awt.Color(254, 254, 254));
        panelContInformesContenido.setLayout(new java.awt.BorderLayout());

        jPanel5.setLayout(new java.awt.BorderLayout());

        jPanel4.setBackground(new java.awt.Color(254, 254, 254));

        botonCrearInforme.setText("Crear informe");
        botonCrearInforme.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCrearInformeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(290, 290, 290)
                .addComponent(botonCrearInforme)
                .addContainerGap(270, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(botonCrearInforme)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        jPanel5.add(jPanel4, java.awt.BorderLayout.PAGE_START);

        jPanel7.setBackground(new java.awt.Color(254, 254, 254));
        jPanel7.setLayout(new java.awt.BorderLayout());

        jPanel8.setBackground(new java.awt.Color(254, 254, 254));

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 231, Short.MAX_VALUE)
        );

        jPanel7.add(jPanel8, java.awt.BorderLayout.LINE_START);

        jPanel9.setBackground(new java.awt.Color(254, 254, 254));
        jPanel9.setPreferredSize(new java.awt.Dimension(662, 50));

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 662, Short.MAX_VALUE)
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 50, Short.MAX_VALUE)
        );

        jPanel7.add(jPanel9, java.awt.BorderLayout.PAGE_START);

        jPanel10.setBackground(new java.awt.Color(254, 254, 254));

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 231, Short.MAX_VALUE)
        );

        jPanel7.add(jPanel10, java.awt.BorderLayout.LINE_END);

        panelInforme.setBackground(new java.awt.Color(234, 234, 234));
        panelInforme.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(31, 2, 151)));

        jLabel13.setFont(new java.awt.Font("Cantarell", 1, 24)); // NOI18N
        jLabel13.setText("INFORME");

        jLabel14.setFont(new java.awt.Font("Cantarell", 3, 15)); // NOI18N
        jLabel14.setText("Lugar:");

        jLabel15.setFont(new java.awt.Font("Cantarell", 3, 15)); // NOI18N
        jLabel15.setText("Fecha:");

        jLabel16.setFont(new java.awt.Font("Cantarell", 3, 15)); // NOI18N
        jLabel16.setText("Consumo total:");

        lblLugar.setFont(new java.awt.Font("Cantarell", 1, 15)); // NOI18N

        lblFecha.setFont(new java.awt.Font("Cantarell", 1, 15)); // NOI18N

        lblValor.setFont(new java.awt.Font("Cantarell", 1, 15)); // NOI18N

        jLabel17.setFont(new java.awt.Font("Cantarell", 3, 15)); // NOI18N
        jLabel17.setText("KW");

        jLabel18.setFont(new java.awt.Font("Cantarell", 3, 15)); // NOI18N
        jLabel18.setText("Consumo medio:");

        lblConsumoMedio.setFont(new java.awt.Font("Cantarell", 1, 15)); // NOI18N

        jLabel19.setFont(new java.awt.Font("Cantarell", 3, 15)); // NOI18N
        jLabel19.setText("KW");

        javax.swing.GroupLayout panelInformeLayout = new javax.swing.GroupLayout(panelInforme);
        panelInforme.setLayout(panelInformeLayout);
        panelInformeLayout.setHorizontalGroup(
            panelInformeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInformeLayout.createSequentialGroup()
                .addGroup(panelInformeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelInformeLayout.createSequentialGroup()
                        .addGap(192, 192, 192)
                        .addComponent(jLabel13))
                    .addGroup(panelInformeLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel14)
                        .addGap(18, 18, 18)
                        .addComponent(lblLugar))
                    .addGroup(panelInformeLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel15)
                        .addGap(18, 18, 18)
                        .addComponent(lblFecha))
                    .addGroup(panelInformeLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel16)
                        .addGap(18, 18, 18)
                        .addComponent(lblValor)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel17))
                    .addGroup(panelInformeLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel18)
                        .addGap(18, 18, 18)
                        .addComponent(lblConsumoMedio)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel19)))
                .addContainerGap(156, Short.MAX_VALUE))
        );
        panelInformeLayout.setVerticalGroup(
            panelInformeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInformeLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel13)
                .addGap(60, 60, 60)
                .addGroup(panelInformeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(lblLugar))
                .addGap(18, 18, 18)
                .addGroup(panelInformeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(lblFecha))
                .addGap(18, 18, 18)
                .addGroup(panelInformeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(lblValor)
                    .addComponent(jLabel17))
                .addGap(18, 18, 18)
                .addGroup(panelInformeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(lblConsumoMedio)
                    .addComponent(jLabel19))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel7.add(panelInforme, java.awt.BorderLayout.CENTER);

        jPanel12.setBackground(new java.awt.Color(254, 254, 254));

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 662, Short.MAX_VALUE)
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        jPanel7.add(jPanel12, java.awt.BorderLayout.PAGE_END);

        jPanel5.add(jPanel7, java.awt.BorderLayout.CENTER);

        panelContInformesContenido.add(jPanel5, java.awt.BorderLayout.CENTER);

        panelContInformesSeleccion1.setBackground(new java.awt.Color(254, 254, 254));
        panelContInformesSeleccion1.setLayout(new java.awt.GridLayout(1, 0));

        jPanel6.setBackground(new java.awt.Color(254, 254, 254));

        jLabel8.setText("Territorio:");

        comboSelecTerritorio.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Localidades", "Provincias" }));
        comboSelecTerritorio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboSelecTerritorioActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap(99, Short.MAX_VALUE)
                .addComponent(jLabel8)
                .addGap(18, 18, 18)
                .addComponent(comboSelecTerritorio, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(comboSelecTerritorio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelContInformesSeleccion1.add(jPanel6);

        PanelSelector1.setBackground(new java.awt.Color(254, 254, 254));
        PanelSelector1.setLayout(new java.awt.CardLayout());

        SelectorMensual1.setBackground(new java.awt.Color(254, 254, 254));

        jLabel11.setText("Localidad:");

        comboSelecLocalidad.setModel(new javax.swing.DefaultComboBoxModel(arrayLocalidades));

        javax.swing.GroupLayout SelectorMensual1Layout = new javax.swing.GroupLayout(SelectorMensual1);
        SelectorMensual1.setLayout(SelectorMensual1Layout);
        SelectorMensual1Layout.setHorizontalGroup(
            SelectorMensual1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SelectorMensual1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11)
                .addGap(18, 18, 18)
                .addComponent(comboSelecLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(88, Short.MAX_VALUE))
        );
        SelectorMensual1Layout.setVerticalGroup(
            SelectorMensual1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SelectorMensual1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(SelectorMensual1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboSelecLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addContainerGap())
        );

        PanelSelector1.add(SelectorMensual1, "card2");

        SelectorAnual1.setBackground(new java.awt.Color(254, 254, 254));

        comboSelecProvincia.setBackground(new java.awt.Color(254, 254, 254));
        comboSelecProvincia.setModel(new javax.swing.DefaultComboBoxModel(arrayProvincias));

        jLabel12.setText("Provincia:");

        javax.swing.GroupLayout SelectorAnual1Layout = new javax.swing.GroupLayout(SelectorAnual1);
        SelectorAnual1.setLayout(SelectorAnual1Layout);
        SelectorAnual1Layout.setHorizontalGroup(
            SelectorAnual1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SelectorAnual1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel12)
                .addGap(18, 18, 18)
                .addComponent(comboSelecProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(91, Short.MAX_VALUE))
        );
        SelectorAnual1Layout.setVerticalGroup(
            SelectorAnual1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SelectorAnual1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(SelectorAnual1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboSelecProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addContainerGap())
        );

        PanelSelector1.add(SelectorAnual1, "card2");

        panelContInformesSeleccion1.add(PanelSelector1);

        panelContInformesContenido.add(panelContInformesSeleccion1, java.awt.BorderLayout.PAGE_START);

        panelContenidoInformes.add(panelContInformesContenido, java.awt.BorderLayout.CENTER);

        PanelContenido.add(panelContenidoInformes, "card4");

        jPanel1.add(PanelContenido, java.awt.BorderLayout.CENTER);

        lblEstadoBD.setForeground(new java.awt.Color(255, 0, 0));
        lblEstadoBD.setText("No se ha conectado con la Base de Datos");

        jMenu3.setText("Opciones");

        menuItemConectar.setText("Conectar");
        menuItemConectar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemConectarActionPerformed(evt);
            }
        });
        jMenu3.add(menuItemConectar);

        menuItemSalir.setText("Salir");
        menuItemSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemSalirActionPerformed(evt);
            }
        });
        jMenu3.add(menuItemSalir);

        jMenuBar1.add(jMenu3);

        jMenu1.setText("Administración");

        jMenuItem4.setText("Clientes");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem4);

        jMenuItem2.setText("Base de datos");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        jMenuBar1.add(jMenu1);

        Informes.setText("Informes");

        jMenuItem5.setText("Generar informe");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        Informes.add(jMenuItem5);

        jMenuBar1.add(Informes);

        jMenu2.setBackground(new java.awt.Color(94, 94, 94));
        jMenu2.setText("Ayuda");

        jMenuItem1.setBackground(new java.awt.Color(94, 94, 94));
        jMenuItem1.setText("Acerca de...");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 837, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblEstadoBD)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 536, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblEstadoBD))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void menuItemConectarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemConectarActionPerformed
       DialogoConexion conexion= new DialogoConexion(this,rootPaneCheckingEnabled,gestor);
       conexion.setVisible(true);
    }//GEN-LAST:event_menuItemConectarActionPerformed

    private void menuItemSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemSalirActionPerformed
       DialogoSalida salida= new DialogoSalida(this, rootPaneCheckingEnabled);
       salida.setVisible(true);
       if (salida.getReturnStatus()==1)
       {
           gestor.CerrarAplicacion();
       }
    }//GEN-LAST:event_menuItemSalirActionPerformed

    private void botonClientesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonClientesActionPerformed
        if (gestor.isConectado())
        {
        panelContenidoInicial.setVisible(false);
        panelContenidoClientes.setVisible(true);
        panelContenidoInformes.setVisible(false);
        }
        else
        {
            AccesoNoPermitido prohibido=new AccesoNoPermitido();
            prohibido.setVisible(true);
        }
    }//GEN-LAST:event_botonClientesActionPerformed

    private void txtApellido1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtApellido1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtApellido1ActionPerformed

    private void botonBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBuscarActionPerformed
        //Declaración de variables
        String provincia;
        String codProvincia;
        String localidad;
        String codLocalidad;
        String calle;
        String codCalle;
        ArrayList<Cliente> listaClientes;
        Iterator it;
        
        
        //En primer lugar, borraremos los datos existentes en la tabla de clientes
        tablaCliente.getDataVector().clear();
        
        //Seguidamente hallaremos el código de provincia, localidad y calle (pues lo único
        //que tenemos es como se llaman
        codProvincia=gestor.getCodigoProvincia(comboProvincia.getSelectedItem().toString());
        codLocalidad=gestor.getCodigoLocalidad(comboLocalidades.getSelectedItem().toString());
        codCalle=gestor.getCodigoCalle(codLocalidad,comboCalles.getSelectedItem().toString());
        //BuscarCliente(nombre,apellido1,apellido2,provincia,localidad,calle,numero,piso,metros)
        listaClientes=gestor.BuscarCliente(txtNombre.getText(), txtApellido1.getText(), txtApellido2.getText(),
        codProvincia,codLocalidad,codCalle,txtNumero.getText(),txtPiso.getText(),txtMetro.getText());
        
        //Añadimos todos los clientes encontrados a la tabla
        it=listaClientes.iterator(); //Iterador de listaClientes
        while(it.hasNext())
        {
            Cliente cli=(Cliente)it.next();
            //Convertimos los códigos de provincia, localidad y calle, ya que mostraremos los nombres
            provincia=gestor.getNombreProvincia(String.valueOf(cli.getProvincia()));
            localidad=gestor.getNombreLocalidad(cli.getLocalidad());
            calle=gestor.getNombreCalle(String.valueOf(cli.getCalle()));
            String[] arrayCliente={cli.getNombre(),cli.getApellido1(),cli.getApellido2(),provincia,localidad,calle,
                        String.valueOf(cli.getNumero()),String.valueOf(cli.getPiso()),String.valueOf(cli.getMetros())};
            tablaCliente.addRow(arrayCliente); //Añade el array de datos del cliente a la tabla
        }
            
    }//GEN-LAST:event_botonBuscarActionPerformed

    private void comboCallesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboCallesActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_comboCallesActionPerformed

    private void txtApellido2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtApellido2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtApellido2ActionPerformed

    private void comboProvinciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboProvinciaActionPerformed
        String item;
        comboLocalidades.removeAllItems();
        ArrayList<String> listaLocalidades=gestor.getLocalidades(comboProvincia.getSelectedItem().toString());
        Iterator<String> iterador = listaLocalidades.iterator();
        while (iterador.hasNext()) {
        item = iterador.next();
        comboLocalidades.addItem(item);
        }  
    }//GEN-LAST:event_comboProvinciaActionPerformed

    private void comboLocalidadesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboLocalidadesActionPerformed
        if ((comboLocalidades.getSelectedItem()!=null)&&(comboLocalidades.getSelectedItem().toString()!="<-- Sin localidades -->"))
        {
        String item;
            comboCalles.removeAllItems();
            ArrayList<String> listaCalles=gestor.getCalles(comboLocalidades.getSelectedItem().toString());
            Iterator<String> iteradorCalles = listaCalles.iterator();
            while (iteradorCalles.hasNext()) 
            {
            item = iteradorCalles.next();
            comboCalles.addItem(item);
            }
        }
    }//GEN-LAST:event_comboLocalidadesActionPerformed

    private void tablaClientesAsociadaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaClientesAsociadaMouseClicked

        String nombre;
        String apellido1;
        String apellido2;
        String provincia;
        String localidad;
        String calle;
        String numero;
        String piso;
        String metros;
        int codProvincia;
        String codLocalidad;
        int codCalle;
        
        //Variables auxiliares necesarias unicamente para simplificar el tratamiento de datos
        int num,pis,met;

        nombre=(String) tablaClientesAsociada.getValueAt(tablaClientesAsociada.getSelectedRow(),0);
        apellido1=(String) tablaClientesAsociada.getValueAt(tablaClientesAsociada.getSelectedRow(),1);
        apellido2=(String) tablaClientesAsociada.getValueAt(tablaClientesAsociada.getSelectedRow(),2);
        provincia=(String) tablaClientesAsociada.getValueAt(tablaClientesAsociada.getSelectedRow(),3);
        localidad=(String) tablaClientesAsociada.getValueAt(tablaClientesAsociada.getSelectedRow(),4);
        calle=(String) tablaClientesAsociada.getValueAt(tablaClientesAsociada.getSelectedRow(),5);
        numero=(String) tablaClientesAsociada.getValueAt(tablaClientesAsociada.getSelectedRow(),6);
        piso=(String) tablaClientesAsociada.getValueAt(tablaClientesAsociada.getSelectedRow(),7);
        metros=(String) tablaClientesAsociada.getValueAt(tablaClientesAsociada.getSelectedRow(),8);
        
        txtNombre.setText(nombre);
        txtApellido1.setText(apellido1);
        txtApellido2.setText(apellido2);
        comboProvincia.setSelectedItem(provincia);
        comboLocalidades.setSelectedItem(localidad);
        comboCalles.setSelectedItem(calle);
        txtNumero.setText(numero);
        txtPiso.setText(piso);
        txtMetro.setText(metros);
        
        num=Integer.parseInt(numero);
        pis=Integer.parseInt(piso);
        met=Integer.parseInt(metros);
        
        codProvincia=Integer.parseInt(gestor.getCodigoProvincia(provincia));
        codLocalidad=gestor.getCodigoLocalidad(localidad);
        codCalle=Integer.parseInt(gestor.getCodigoCalle(codLocalidad, calle));
        clienteSeleccionado=new Cliente(nombre, apellido1, apellido2, codProvincia,codLocalidad,
                           codCalle,num,pis,met);
    }//GEN-LAST:event_tablaClientesAsociadaMouseClicked

    private void botonModificarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonModificarClienteActionPerformed
        //Enviamos los datos necesarios para que el gestor modifique la base de datos
        gestor.ModificarDatosCliente(clienteSeleccionado,txtNombre.getText(),txtApellido1.getText(),
        txtApellido2.getText(),comboProvincia.getSelectedItem().toString(),comboLocalidades.getSelectedItem().toString(),
        comboCalles.getSelectedItem().toString(),txtNumero.getText(),txtPiso.getText(),txtMetro.getText());
    }//GEN-LAST:event_botonModificarClienteActionPerformed

    private void botonNuevoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonNuevoClienteActionPerformed
        //Enviamos los datos necesarios para que el gestor los añada a la base de datos
        gestor.AddCliente(txtNombre.getText(),txtApellido1.getText(),txtApellido2.getText(),
        comboProvincia.getSelectedItem().toString(),comboLocalidades.getSelectedItem().toString(),
        comboCalles.getSelectedItem().toString(),txtNumero.getText(),txtPiso.getText(),txtMetro.getText());
    }//GEN-LAST:event_botonNuevoClienteActionPerformed

    private void botonBorrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBorrarActionPerformed
        //Enviamos los datos necesarios para que el gestor borre el cliente seleccionado
        gestor.BorrarCliente(clienteSeleccionado);
        botonBuscarActionPerformed(evt);
    }//GEN-LAST:event_botonBorrarActionPerformed

    private void botonInformesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonInformesActionPerformed
        if(gestor.isConectado())
        {
        panelContenidoInicial.setVisible(false);
        panelContenidoClientes.setVisible(false);
        panelContenidoInformes.setVisible(true);
        }
        else
        {
            AccesoNoPermitido prohibido=new AccesoNoPermitido();
            prohibido.setVisible(true);
        }
    }//GEN-LAST:event_botonInformesActionPerformed

    private void botonVerInformeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonVerInformeActionPerformed
        DialogoInformeUsuario dialogoInforme=new DialogoInformeUsuario(clienteSeleccionado,gestor);
        dialogoInforme.setVisible(true);
    }//GEN-LAST:event_botonVerInformeActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        if(gestor.isConectado())
        {
        panelContenidoInicial.setVisible(false);
        panelContenidoClientes.setVisible(true);
        panelContenidoInformes.setVisible(false);
        }
        else
        {
            AccesoNoPermitido prohibido=new AccesoNoPermitido();
            prohibido.setVisible(true);
        }
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        if(gestor.isConectado())
        {
        panelContenidoInicial.setVisible(false);
        panelContenidoClientes.setVisible(false);
        panelContenidoInformes.setVisible(true);
        }
        else
        {
            AccesoNoPermitido prohibido=new AccesoNoPermitido();
            prohibido.setVisible(true);
        }
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        Creditos creditos=new Creditos();
        creditos.setVisible(true);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void comboTipoInformeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboTipoInformeActionPerformed
        PanelSelector.setVisible(true);
        if(comboTipoInforme.getSelectedItem().equals("Mensual"))
        {
            SelectorAnual.setVisible(false);
            SelectorMensual.setVisible(true);
        }
        else
        {
            SelectorMensual.setVisible(false);
            SelectorAnual.setVisible(true);
        }
    }//GEN-LAST:event_comboTipoInformeActionPerformed

    private void comboSelecTerritorioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSelecTerritorioActionPerformed
         PanelSelector1.setVisible(true);
        if(comboSelecTerritorio.getSelectedItem().equals("Localidades"))
        {
            this.arrayLocalidades=gestor.ListarNombresLocalidades();
            for (int i=0;i<arrayLocalidades.length;i++)
            {
                comboSelecLocalidad.addItem(arrayLocalidades[i]);
            }
            SelectorAnual1.setVisible(false);
            SelectorMensual1.setVisible(true);
            }
        else
        {
            SelectorMensual1.setVisible(false);
            SelectorAnual1.setVisible(true);
        }
    }//GEN-LAST:event_comboSelecTerritorioActionPerformed

    private void botonCrearInformeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCrearInformeActionPerformed
        panelContInformesContenido.setVisible(true);
        panelContenidoInformes.setVisible(true);
        panelInforme.setVisible(true);
        String fecha;
        String lugar;
        String[] valor=new String[2];
        String mesString;
        int tipoInforme=0;
        if ((comboTipoInforme.getSelectedItem().toString()).equals("Mensual")) {
            fecha = Integer.toString(comboSelecMes.getSelectedIndex()+1);
            mesString=comboSelecMes.getSelectedItem().toString();
        } else {
            tipoInforme=2;
            fecha = comboSelecAnho.getSelectedItem().toString();
            mesString=fecha;
        }
        if ((comboSelecTerritorio.getSelectedItem().toString()).equals("Localidades")) {
            lugar = comboSelecLocalidad.getSelectedItem().toString();
        } else {
            tipoInforme+=1;
            lugar = comboSelecProvincia.getSelectedItem().toString();
        }
        valor=gestor.getDatosInforme(tipoInforme,fecha,lugar);
        lblLugar.setText(lugar);
        lblFecha.setText(mesString);
        lblValor.setText(valor[1]);
        lblConsumoMedio.setText(valor[0]);
        
    }//GEN-LAST:event_botonCrearInformeActionPerformed

    private void comboSelecAnhoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSelecAnhoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_comboSelecAnhoActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        if(gestor.isConectado())
        {
        EdicionBD editarBD=new EdicionBD(gestor);
        editarBD.setVisible(true);
        }
        else
        {
            AccesoNoPermitido prohibido=new AccesoNoPermitido();
            prohibido.setVisible(true);
        }
    }//GEN-LAST:event_jMenuItem2ActionPerformed

 
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        //Si se ejecuta el programa desde consola e incorpora parámetros 
        if(args.length>0)
        {
            EjecucionParametros parametros = new EjecucionParametros();
            if(parametros.checkParametros(args))
            {
                parametros.EjecutarPrograma();
            }else{ //Si el formato de los parámetros imtroducidos no es el correcto
                
            }
            
        }
        else
        {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Principal().setVisible(true);
            }
        });
        }
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu Informes;
    private javax.swing.JPanel PanelContenido;
    private javax.swing.JPanel PanelSelector;
    private javax.swing.JPanel PanelSelector1;
    private javax.swing.JPanel SelectorAnual;
    private javax.swing.JPanel SelectorAnual1;
    private javax.swing.JPanel SelectorMensual;
    private javax.swing.JPanel SelectorMensual1;
    private javax.swing.JButton botonBorrar;
    private javax.swing.JButton botonBuscar;
    private javax.swing.JButton botonClientes;
    private javax.swing.JButton botonCrearInforme;
    private javax.swing.JButton botonInformes;
    private javax.swing.JButton botonModificarCliente;
    private javax.swing.JButton botonNuevoCliente;
    private javax.swing.JButton botonVerInforme;
    private javax.swing.JComboBox comboCalles;
    private javax.swing.JComboBox comboLocalidades;
    private javax.swing.JComboBox comboProvincia;
    private javax.swing.JComboBox comboSelecAnho;
    private javax.swing.JComboBox comboSelecLocalidad;
    private javax.swing.JComboBox comboSelecMes;
    private javax.swing.JComboBox comboSelecProvincia;
    private javax.swing.JComboBox comboSelecTerritorio;
    private javax.swing.JComboBox comboTipoInforme;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JLabel lblClientes;
    private javax.swing.JLabel lblConsumoMedio;
    private javax.swing.JLabel lblCopyLeft;
    private javax.swing.JLabel lblEstadoBD;
    private javax.swing.JLabel lblFecha;
    private javax.swing.JLabel lblLugar;
    private javax.swing.JLabel lblValor;
    private javax.swing.JLabel lblimagenInformes;
    private javax.swing.JMenuItem menuItemConectar;
    private javax.swing.JMenuItem menuItemSalir;
    private javax.swing.JPanel panelContCliBusqueda;
    private javax.swing.JPanel panelContCliLista;
    private javax.swing.JPanel panelContCliOpciones;
    private javax.swing.JPanel panelContInformesContenido;
    private javax.swing.JPanel panelContInformesSeleccion;
    private javax.swing.JPanel panelContInformesSeleccion1;
    private javax.swing.JPanel panelContenidoClientes;
    private javax.swing.JPanel panelContenidoInformes;
    private javax.swing.JPanel panelContenidoInicial;
    private javax.swing.JPanel panelInforme;
    private javax.swing.JTable tablaClientesAsociada;
    private javax.swing.JTextField txtApellido1;
    private javax.swing.JTextField txtApellido2;
    private javax.swing.JTextField txtMetro;
    private javax.swing.JTextField txtNombre;
    private javax.swing.JTextField txtNumero;
    private javax.swing.JTextField txtPiso;
    // End of variables declaration//GEN-END:variables
private String[] arrayProvincias=new String[0];
//private String[] arrayProvincias=gestor.ListarNombresLocalidades();
private String[] arrayLocalidades=new String[0];

    private void initImagenes() 
{
            
            String path = "imagenes/clientes.png";  
            ImageIcon icon = new ImageIcon(path);
            Icon icono = new ImageIcon(icon.getImage().getScaledInstance(130,130, Image.SCALE_DEFAULT));
            lblClientes.setIcon(icono); 
            
            
            path = "imagenes/informes.png";  
            icon = new ImageIcon(path);
            icono = new ImageIcon(icon.getImage().getScaledInstance(120,120, Image.SCALE_DEFAULT));
            lblimagenInformes.setIcon(icono); 
            
            path = "imagenes/copyleft.png";  
            icon = new ImageIcon(path);
            icono = new ImageIcon(icon.getImage().getScaledInstance(30,30, Image.SCALE_DEFAULT));
            lblCopyLeft.setIcon(icono);  
    }
    
    public void CambiarEstadoBarra()
    {
        lblEstadoBD.setText("La conexión con la Base de Datos se encuentra establecida");
        lblEstadoBD.setForeground(new java.awt.Color(29,160,1));
        arrayLocalidades=gestor.ListarNombresLocalidades();
        arrayProvincias=gestor.ListarNombresProvincias();
        comboSelecProvincia.setModel(new javax.swing.DefaultComboBoxModel(arrayProvincias));
        comboProvincia.setModel(new javax.swing.DefaultComboBoxModel(arrayProvincias));
        //gestor.ListarProvincias().toArray(new String[gestor.ListarProvincias().size()])
    }

    private void initPaneles() {
        panelContenidoInicial.setVisible(true);
        panelContenidoClientes.setVisible(false);
        panelContenidoInformes.setVisible(false);
        PanelSelector.setVisible(false);
        PanelSelector1.setVisible(false);
        panelInforme.setVisible(false);
    }
}
